﻿Imports DCM
Public Class DCM_CN
    Implements IDisposable
    Public CN_Server As Object = Nothing
    Public DCM_SQLServer_DataBase As DCMHttp_Enum_DataBaseName = DCMHttp_Enum_DataBaseName.None
    Public DCMHttp_Enum_ConnectStyle As DCMHttp_Enum_ConnectStyle = DCM.DCMHttp_Enum_ConnectStyle.None
    Public DataBaseType As DCM.Enum_数据库类型 = Enum_数据库类型.SQLServer
    Private _dCMHttp_Enum_DataBaseName As DCMHttp_Enum_DataBaseName

    Public Sub New(DCMHttp_Enum_DataBaseName As DCMHttp_Enum_DataBaseName, DCMHttp_Enum_ConnectStyle As DCMHttp_Enum_ConnectStyle)
        Select Case DCMHttp_Enum_DataBaseName
            Case dcm.DCMHttp_Enum_DataBaseName.CQPI_cmehr
                IniMe(DCMHttp_Enum_DataBaseName, DCMHttp_Enum_ConnectStyle, DCM.Enum_数据库类型.Oracle)
            Case Else
                IniMe(DCMHttp_Enum_DataBaseName, DCMHttp_Enum_ConnectStyle, DCM.Enum_数据库类型.SQLServer)
        End Select
    End Sub

    Public Sub New(DCMHttp_Enum_DataBaseName As DCMHttp_Enum_DataBaseName,
                   DCMHttp_Enum_ConnectStyle As DCMHttp_Enum_ConnectStyle,
                   DataBaseType As Enum_数据库类型)
        IniMe(DCMHttp_Enum_DataBaseName, DCMHttp_Enum_ConnectStyle, DataBaseType)
    End Sub
    Public Sub New()
    End Sub

    Sub New(DCMHttp_Enum_DataBaseName As DCMHttp_Enum_DataBaseName)
        ' TODO: Complete member initialization 
        _dCMHttp_Enum_DataBaseName = DCMHttp_Enum_DataBaseName
    End Sub

    Private Sub IniMe(DCM_SQLServer_DataBase As DCMHttp_Enum_DataBaseName,
                      DCMHttp_Enum_ConnectStyle As DCMHttp_Enum_ConnectStyle,
                      DataBaseType As Enum_数据库类型)
        Me.DCM_SQLServer_DataBase = DCM_SQLServer_DataBase
        Me.DCMHttp_Enum_ConnectStyle = DCMHttp_Enum_ConnectStyle
        Me.DataBaseType = DataBaseType
        CN_Server = Nothing
    End Sub
#Region "IDisposable Support"
    Private disposedValue As Boolean ' 检测冗余的调用
    ' IDisposable
    Protected Overridable Sub Dispose(disposing As Boolean)
        If Not Me.disposedValue Then
            If disposing Then
                Try
                    If IsNothing(CN_Server) = False Then CN_Server.Dispose()
                Catch ex As Exception
                End Try
                ' TODO:  释放托管状态(托管对象)。
            End If
            ' TODO:  释放非托管资源(非托管对象)并重写下面的 Finalize()。
            ' TODO:  将大型字段设置为 null。
        End If
        Me.disposedValue = True
    End Sub

    ' TODO:  仅当上面的 Dispose(ByVal disposing As Boolean)具有释放非托管资源的代码时重写 Finalize()。
    'Protected Overrides Sub Finalize()
    '    ' 不要更改此代码。    请将清理代码放入上面的 Dispose(ByVal disposing As Boolean)中。
    '    Dispose(False)
    '    MyBase.Finalize()
    'End Sub

    ' Visual Basic 添加此代码是为了正确实现可处置模式。
    Public Sub Dispose() Implements IDisposable.Dispose
        ' 不要更改此代码。    请将清理代码放入上面的 Dispose (disposing As Boolean)中。
        Dispose(True)
        GC.SuppressFinalize(Me)
    End Sub
#End Region
End Class